<template>
    <div class="city">
        <ul>
            <li v-for="(item,index) in cityArr" :key="index" @click="backFn(item)">
                <h2>{{item}}</h2>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
  data () {
    return {
      cityArr: ['北京', '上海', '广州', '深圳', '茂名', '张家界', '清远', '汕头', '佛山']
    }
  },
  methods: {
    backFn (e) {
      // this.$store.commit('setCity', e)
      this.$store.dispatch('setCityName', e)
    }
  }
}
</script>

<style>

</style>
